package com.syt.task.scheduled;

import com.syt.rabbitmq.constant.MqConst;
import com.syt.rabbitmq.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: xxx
 * @Date: 2023/3/1 21:09
 * @Description: 定时任务
 */
@Component
//开启定时任务
@EnableScheduling
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;



    //每天八点执行方法，提醒就医
    //cron表达式 设置执行间隔
    @Scheduled(cron = "0 0 8 * * ? ")
    public void scheduledPatient(){
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");
    }
}
